#!/bin/bash

if [ "$(id -u)" != "0" ]; then
    echo "该脚本需要管理员权限，请使用 sudo 运行。" 1>&2
    exit 1
fi

wget -O Ubuntu_Change.sh "https://gitcode.com/JSY198848/Ubuntu_Soft_LNMP/releases/download/V1.1/Ubuntu_Change.sh"
chmod +x Ubuntu_Change.sh
./Ubuntu_Change.sh

sudo apt update && sudo apt upgrade -y
sudo apt autoremove

sudo apt install -y wget unzip libglu1-mesa libatk1.0-0 libcairo2-dev libpango1.0-dev  libxrender-dev libxext-dev libxfixes-dev libgtk2.0-0

install_wps() {
    wget -O wps_symbol_fonts.tar "https://gitcode.com/JSY198848/Ubuntu_Soft_LNMP/releases/download/v2.0/wps_symbol_fonts.tar"
    wget -O WPS-Office.deb "https://gitcode.com/JSY198848/Ubuntu_Soft_LNMP/releases/download/V1.0/WPS_Office_12.1.0_amd64.deb"
    dpkg -i WPS-Office.deb || apt install -f -y
    tar xvf wps_symbol_fonts.tar
    chmod 777  wps_symbol_fonts
    cd wps_symbol_fonts
    sudo cp * /usr/share/fonts
    sudo mkfontscale
    sudo mkfontdir
    sudo fc-cache
    sudo touch wpsupdate
    sudo chmod 000 wpsupdate  
}

install_dev_tools() {
    sudo apt install -y python3 python3-pip gcc g++ gdb make
}
install_dev_tools
install_wps